package wyy

import (
	"api-go/serializer"
	wyy "api-go/service/v1/wyy"
	"fmt"

	"github.com/gin-gonic/gin"
)

//获取歌曲链接
func SongUrl(c *gin.Context) {
	var service wyy.Song
	var res *serializer.Response
	if err := c.ShouldBind(&service); err != nil {
		fmt.Println(err)
		res = serializer.ErrorResponse(serializer.CodeParamError)
	} else {
		res = service.SongUrl()
	}
	c.JSON(200, res)
}

//获取歌曲详细信息
func SongInfo(c *gin.Context) {
	var service wyy.Song
	var res *serializer.Response
	if err := c.ShouldBindQuery(&service); err != nil {
		fmt.Println(err)
		res = serializer.ErrorResponse(serializer.CodeParamError)
	} else {
		res = service.SongInfo()
	}
	c.JSON(200, res)
}

//获取歌曲歌词
func SongLyric(c *gin.Context) {
	var service wyy.Song
	var res *serializer.Response
	if err := c.ShouldBindQuery(&service); err != nil {
		fmt.Println(err)
		res = serializer.ErrorResponse(serializer.CodeParamError)
	} else {
		res = service.SongLyric()
	}
	c.JSON(200, res)
}

//获取新歌
func SongNew(c *gin.Context) {
	var service wyy.Song
	var res *serializer.Response
	if err := c.ShouldBindQuery(&service); err != nil {
		fmt.Println(err)
		res = serializer.ErrorResponse(serializer.CodeParamError)
	} else {
		res = service.SongNew()
	}
	c.JSON(200, res)
}
